<?php

namespace App\Containers\AppSection\Moneybox\Tasks;

use App\Ship\Exceptions\InternalErrorException;
use App\Ship\Parents\Tasks\Task;
use Exception;
use Illuminate\Support\Str;

class GenerateUuidAndIdTask extends Task
{
    public function run(): array
    {
        try {
            $data = [];

            $data['uuid'] = Str::uuid()->toString();

            $data['p2p_id'] = config('appSection-moneybox.id', '');
            if ($data['p2p_id'] == '') {
                throw new Exception('empty p2p_id');
            }

            return $data;
        } catch (Exception $exception) {
            throw new InternalErrorException();
        }

    }
}
